package view;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;
import javax.swing.SwingConstants;

import controller.AddProductController;
import controller.AddSubController;
import controller.ViewProductController;
import controller.ViewSupController;

public class MenuProductsPanel extends JPanel {
	private static final long serialVersionUID = 1L;
	private JButton btnViewPro;
	private JButton btnAddPro;
	private JButton btnViewSupplier;
	private JButton btnAddSupplier;
	private JToolBar toolbarProduct;
	
	private Home home;

	public MenuProductsPanel(Home home) {
		this.home = home;
		initComponents();
		controller();
	}

	private void initComponents() {

		toolbarProduct = new JToolBar();
		btnViewPro = new JButton();
		btnAddPro = new JButton();
		btnViewSupplier = new JButton();
		btnAddSupplier = new JButton();

		setBackground(new java.awt.Color(255, 255, 255));
		setLayout(null);

		toolbarProduct.setFloatable(false);
		toolbarProduct.setOrientation(SwingConstants.VERTICAL);
		toolbarProduct.setRollover(true);
		toolbarProduct.setOpaque(false);

		btnViewPro.setFont(new java.awt.Font("Calibri", 1, 18));
		btnViewPro.setIcon(new ImageIcon("icon/viewpro.png"));
		btnViewPro.setText("View Products");
		btnViewPro.setFocusable(false);
		btnViewPro.setHorizontalTextPosition(SwingConstants.CENTER);
		btnViewPro.setOpaque(false);
		btnViewPro.setVerticalTextPosition(SwingConstants.BOTTOM);
		toolbarProduct.add(btnViewPro);

		btnAddPro.setFont(new java.awt.Font("Calibri", 1, 18));
		btnAddPro.setIcon(new ImageIcon("icon/AddPro.png"));
		btnAddPro.setText("Add Products");
		btnAddPro.setFocusable(false);
		btnAddPro.setHorizontalTextPosition(SwingConstants.CENTER);
		btnAddPro.setOpaque(false);
		btnAddPro.setVerticalTextPosition(SwingConstants.BOTTOM);
		toolbarProduct.add(btnAddPro);

		btnViewSupplier.setFont(new java.awt.Font("Calibri", 1, 18));
		btnViewSupplier.setIcon(new ImageIcon("icon/viewpro.png"));
		btnViewSupplier.setText("View Supplier");
		btnViewSupplier.setFocusable(false);
		btnViewSupplier.setHorizontalTextPosition(SwingConstants.CENTER);
		btnViewSupplier.setOpaque(false);
		btnViewSupplier.setVerticalTextPosition(SwingConstants.BOTTOM);
		toolbarProduct.add(btnViewSupplier);

		btnAddSupplier.setFont(new java.awt.Font("Calibri", 1, 18));
		btnAddSupplier.setIcon(new ImageIcon("icon/AddPro.png"));
		btnAddSupplier.setText("Add Supplier");
		btnAddSupplier.setFocusable(false);
		btnAddSupplier.setHorizontalTextPosition(SwingConstants.CENTER);
		btnAddSupplier.setOpaque(false);
		btnAddSupplier.setVerticalTextPosition(SwingConstants.BOTTOM);
		toolbarProduct.add(btnAddSupplier);

		add(toolbarProduct);
		toolbarProduct.setBounds(40, 60, 117, 270);
	}

	private void controller(){
		btnAddPro.addActionListener(new AddProductController(home));
		btnAddSupplier.addActionListener(new AddSubController(home));
		btnViewPro.addActionListener(new ViewProductController(home));
		btnViewSupplier.addActionListener(new ViewSupController(home));
	}
	
}
